package com.fz.study.project.controller;


import com.fz.study.project.entity.Result;
import com.fz.study.project.entity.Voucher;
import com.fz.study.project.service.ITbVoucherService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-02-28
 */
@Tag(name = "代金券管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/tb-voucher")
public class VoucherController {

    private final ITbVoucherService voucherService;

    @Operation(summary = "添加限时秒杀代金券")
    @PostMapping("seckill")
    public Result addSeckillVoucher(@RequestBody Voucher voucher){
        voucherService.addSeckillVocher(voucher);
        return Result.success(voucher.getId());
    }
}
